| Country | Boundary Name | Pop-Min | Pop-Max | Household-Min | Household-Max | Total No.Scot 11’ | Total No. Glasgow 11’ |
|---|---|---|---|---|---|---|---|
| Scotland | Output Area | 50 | - | 20 | - | 46351 | 5486 |
| Datazone | 500 | 1000 | - | - | 6976 | 746 | |
| Intermediate Zone | 2500 | 6000 | - | - | 1279 | 136 | |
| England | Output Area | 100 | - | 40 | - | 181408 | - |
| Lower Super Output Area | 1000 | 3000 | 400 | 1200 | 34753 | - | |
| Middle Super Output Area | 5000 | 15000 | 2000 | 6000 | 7201 | - |
Call files: primary schools and intermediate zones
schools <-
read_sf("Glasgow/Bld_Schools_Glasgow.shp") %>%
select(-c(FID_1, FID_2)) %>%
mutate(FID = row_number()) %>%
select(FID, everything())
iz <- read_sf("Glasgow/Glasgow_IZ.shp")
Taking a glance on the data
schools %>%
st_drop_geometry() %>%
glimpse()
## Rows: 318
## Columns: 81
## $ FID <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ~
## $ id <chr> "0D4F710245D627B3E050A00A568A259B", "0D4F7107E62B27B3E050A0~
## $ featcode <dbl> 15014, 15014, 15014, 15014, 15014, 15014, 15014, 15014, 150~
## $ area <dbl> 2629, 30, 31, 39, 1613, 65, 3075, 40, 25, 29, 1664, 1413, 5~
## $ DataZone <chr> "S01010452", "S01010452", "S01010452", "S01010463", "S01010~
## $ LAName <chr> "Glasgow City", "Glasgow City", "Glasgow City", "Glasgow Ci~
## $ SAPE2014 <dbl> 785, 785, 785, 823, 823, 823, 670, 596, 596, 596, 596, 1008~
## $ WASAPE2014 <dbl> 436, 436, 436, 514, 514, 514, 401, 359, 359, 359, 359, 603,~
## $ Rank <dbl> 1554, 1554, 1554, 3317, 3317, 3317, 1285, 1692, 1692, 1692,~
## $ Quintile <dbl> 2, 2, 2, 3, 3, 3, 1, 2, 2, 2, 2, 3, 3, 1, 1, 1, 1, 1, 1, 2,~
## $ Decile <dbl> 3, 3, 3, 5, 5, 5, 2, 3, 3, 3, 3, 5, 5, 1, 2, 1, 1, 1, 1, 3,~
## $ Vigintile <dbl> 5, 5, 5, 10, 10, 10, 4, 5, 5, 5, 5, 10, 10, 1, 3, 1, 1, 1, ~
## $ Percentile <dbl> 23, 23, 23, 48, 48, 48, 19, 25, 25, 25, 25, 48, 48, 2, 14, ~
## $ IncRate <dbl> 0.23, 0.23, 0.23, 0.11, 0.11, 0.11, 0.26, 0.20, 0.20, 0.20,~
## $ IncNumDep <dbl> 180, 180, 180, 85, 85, 85, 175, 120, 120, 120, 120, 110, 11~
## $ IncRank <dbl> 1092, 1092, 1092, 3325, 3325, 3325, 754, 1403, 1403, 1403, ~
## $ EmpRate <dbl> 0.19, 0.19, 0.19, 0.10, 0.10, 0.10, 0.16, 0.16, 0.16, 0.16,~
## $ EmpNumDep <dbl> 85, 85, 85, 50, 50, 50, 65, 60, 60, 60, 60, 55, 55, 95, 70,~
## $ EmpRank <dbl> 1113, 1113, 1113, 3059, 3059, 3059, 1689, 1587, 1587, 1587,~
## $ HlthCIF <dbl> 165, 165, 165, 130, 130, 130, 165, 165, 165, 165, 165, 115,~
## $ HlthAlcSR <dbl> 138.82534, 138.82534, 138.82534, 63.99475, 63.99475, 63.994~
## $ HlthDrugSR <dbl> 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000, 0.000~
## $ HlthSMR <dbl> 117, 117, 117, 96, 96, 96, 148, 80, 80, 80, 80, 97, 97, 208~
## $ HlthDprsPc <dbl> 0.2152866, 0.2152866, 0.2152866, 0.1822600, 0.1822600, 0.18~
## $ HlthLBWTPc <dbl> 0.02941176, 0.02941176, 0.02941176, 0.00000000, 0.00000000,~
## $ HlthEmrgSR <dbl> 109.4836, 109.4836, 109.4836, 112.8559, 112.8559, 112.8559,~
## $ HlthRank <dbl> 1734, 1734, 1734, 2731, 2731, 2731, 1549, 1855, 1855, 1855,~
## $ EduAttend <dbl> 0.8539326, 0.8539326, 0.8539326, 0.8423913, 0.8423913, 0.84~
## $ EduAttain <dbl> 5.500000, 5.500000, 5.500000, 5.083333, 5.083333, 5.083333,~
## $ EduNoQuals <dbl> 153.0186, 153.0186, 153.0186, 101.8701, 101.8701, 101.8701,~
## $ EduNEET <dbl> 0.03, 0.03, 0.03, 0.03, 0.03, 0.03, 0.28, 0.04, 0.04, 0.04,~
## $ EduHESA <dbl> 0.04615385, 0.04615385, 0.04615385, 0.12598425, 0.12598425,~
## $ EduRank <dbl> 2793, 2793, 2793, 3469, 3469, 3469, 1057, 2683, 2683, 2683,~
## $ GAccPetrol <dbl> 4.322612, 4.322612, 4.322612, 3.241190, 3.241190, 3.241190,~
## $ GAccDTGP <dbl> 1.2484531, 1.2484531, 1.2484531, 2.5301074, 2.5301074, 2.53~
## $ GAccDTPost <dbl> 1.892881, 1.892881, 1.892881, 1.843244, 1.843244, 1.843244,~
## $ GAccDTPsch <dbl> 1.5095087, 1.5095087, 1.5095087, 1.2702325, 1.2702325, 1.27~
## $ GAccDTRet <dbl> 3.631134, 3.631134, 3.631134, 3.581010, 3.581010, 3.581010,~
## $ GAccDTSsch <dbl> 4.962037, 4.962037, 4.962037, 3.174072, 3.174072, 3.174072,~
## $ GAccPTGP <dbl> 4.573739, 4.573739, 4.573739, 7.476432, 7.476432, 7.476432,~
## $ GAccPTPost <dbl> 5.335732, 5.335732, 5.335732, 5.875810, 5.875810, 5.875810,~
## $ GAccPTRet <dbl> 11.372774, 11.372774, 11.372774, 11.879900, 11.879900, 11.8~
## $ GAccRank <dbl> 5571, 5571, 5571, 4955, 4955, 4955, 5520, 4951, 4951, 4951,~
## $ CrimeCount <dbl> 12.01810, 12.01810, 12.01810, 20.03017, 20.03017, 20.03017,~
## $ CrimeRate <dbl> 153.0968, 153.0968, 153.0968, 243.3799, 243.3799, 243.3799,~
## $ CrimeRank <dbl> 4305, 4305, 4305, 3033, 3033, 3033, 2179, 552, 552, 552, 55~
## $ HouseNumOC <dbl> 148, 148, 148, 160, 160, 160, 110, 61, 61, 61, 61, 153, 153~
## $ HouseNumNC <dbl> 8, 8, 8, 9, 9, 9, 17, 1, 1, 1, 1, 11, 11, 10, 16, 30, 3, 3,~
## $ HouseOCrat <dbl> 0.18204182, 0.18204182, 0.18204182, 0.20100503, 0.20100503,~
## $ HouseNCrat <dbl> 0.009840098, 0.009840098, 0.009840098, 0.011306533, 0.01130~
## $ HouseRank <dbl> 1328, 1328, 1328, 1019, 1019, 1019, 1347, 3687, 3687, 3687,~
## $ Shape_Leng <dbl> 2953.927, 2953.927, 2953.927, 2850.157, 2850.157, 2850.157,~
## $ Shape_Area <dbl> 142069.8, 142069.8, 142069.8, 180664.8, 180664.8, 180664.8,~
## $ AB <dbl> 54, 54, 54, 118, 118, 118, 62, 41, 41, 41, 41, 58, 58, 6, 1~
## $ C1 <dbl> 180, 180, 180, 136, 136, 136, 96, 120, 120, 120, 120, 199, ~
## $ C2 <dbl> 109, 109, 109, 119, 119, 119, 70, 93, 93, 93, 93, 175, 175,~
## $ DE <dbl> 131, 131, 131, 116, 116, 116, 183, 105, 105, 105, 105, 171,~
## $ OID_ <dbl> 3946, 3946, 3946, 3957, 3957, 3957, 3965, 3974, 3974, 3974,~
## $ All_age <dbl> 813, 813, 813, 796, 796, 796, 666, 623, 623, 623, 623, 1010~
## $ X0_4 <dbl> 36, 36, 36, 44, 44, 44, 40, 25, 25, 25, 25, 62, 62, 47, 54,~
## $ X5_7 <dbl> 25, 25, 25, 14, 14, 14, 28, 17, 17, 17, 17, 33, 33, 24, 37,~
## $ X8_9 <dbl> 14, 14, 14, 19, 19, 19, 12, 8, 8, 8, 8, 28, 28, 18, 11, 19,~
## $ X10_14 <dbl> 30, 30, 30, 44, 44, 44, 36, 55, 55, 55, 55, 58, 58, 48, 47,~
## $ F7 <dbl> 7, 7, 7, 10, 10, 10, 14, 13, 13, 13, 13, 14, 14, 13, 12, 16~
## $ X16_17 <dbl> 22, 22, 22, 24, 24, 24, 11, 17, 17, 17, 17, 16, 16, 25, 20,~
## $ X18_19 <dbl> 15, 15, 15, 20, 20, 20, 16, 15, 15, 15, 15, 25, 25, 26, 23,~
## $ X20_24 <dbl> 51, 51, 51, 39, 39, 39, 31, 19, 19, 19, 19, 52, 52, 34, 48,~
## $ X25_29 <dbl> 31, 31, 31, 36, 36, 36, 51, 27, 27, 27, 27, 39, 39, 27, 60,~
## $ X30_44 <dbl> 148, 148, 148, 136, 136, 136, 137, 126, 126, 126, 126, 173,~
## $ X45_59 <dbl> 153, 153, 153, 191, 191, 191, 127, 119, 119, 119, 119, 233,~
## $ X60_64 <dbl> 54, 54, 54, 43, 43, 43, 38, 38, 38, 38, 38, 65, 65, 16, 34,~
## $ X65_74 <dbl> 95, 95, 95, 78, 78, 78, 61, 56, 56, 56, 56, 80, 80, 54, 27,~
## $ X75_84 <dbl> 98, 98, 98, 61, 61, 61, 44, 65, 65, 65, 65, 87, 87, 19, 0, ~
## $ X85_89 <dbl> 25, 25, 25, 24, 24, 24, 14, 20, 20, 20, 20, 32, 32, 9, 1, 1~
## $ X90plus <dbl> 9, 9, 9, 13, 13, 13, 6, 3, 3, 3, 3, 13, 13, 2, 2, 3, 1, 1, ~
## $ House_nm <dbl> 408, 408, 408, 376, 376, 376, 316, 285, 285, 285, 285, 432,~
## $ no_car <dbl> 199, 199, 199, 129, 129, 129, 149, 107, 107, 107, 107, 163,~
## $ one_car <dbl> 162, 162, 162, 178, 178, 178, 141, 127, 127, 127, 127, 173,~
## $ two_cars <dbl> 41, 41, 41, 57, 57, 57, 23, 45, 45, 45, 45, 79, 79, 12, 35,~
## $ three_car <dbl> 6, 6, 6, 12, 12, 12, 3, 6, 6, 6, 6, 17, 17, 2, 6, 1, 6, 6, ~
## $ Zone <chr> "S01010452", "S01010452", "S01010452", "S01010463", "S01010~
Summary stats
schools %>%
st_drop_geometry() %>%
get_summary_stats()
## # A tibble: 77 x 13
## variable n min max median q1 q3 iqr mad mean sd
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 AB 318 0 320 51.5 19.2 94 7.48e1 5.12e1 7.23e1 7.05e1
## 2 All_age 318 0 1127 756. 640. 886 2.46e2 1.88e2 7.49e2 2.50e2
## 3 area 318 23 8312 684 81.2 1948 1.87e3 9.55e2 1.08e3 1.17e3
## 4 C1 318 0 591 151 105 201 9.6 e1 6.97e1 1.57e2 8.31e1
## 5 C2 318 0 197 96 68 120 5.2 e1 3.63e1 9.33e1 4.06e1
## 6 CrimeCount 318 0 219. 25.0 16.0 45.1 2.90e1 1.93e1 3.39e1 3.10e1
## 7 CrimeRank 318 0 6892 1764. 732 3353 2.62e3 1.76e3 2.10e3 1.63e3
## 8 CrimeRate 318 0 3098. 344. 198. 553. 3.56e2 2.42e2 4.15e2 3.50e2
## 9 DE 318 0 402 182 115 234. 1.19e2 8.30e1 1.78e2 8.69e1
## 10 Decile 318 0 10 2 1 4.75 3.75e0 1.48e0 3.00e0 2.45e0
## # ... with 67 more rows, and 2 more variables: se <dbl>, ci <dbl>
Rank by IZs
# I need to do a spatial join to get a zonal stats
# sptial join and sum
st_join(iz, schools) %>%
group_by(Name) %>%
summarise(no_of_schools = sum(FID)) %>%
select(Name, no_of_schools) -> schools_area
schools_area %>%
st_drop_geometry() %>%
arrange(desc(no_of_schools)) %>%
print(n = Inf)
## # A tibble: 136 x 2
## Name no_of_schools
## <chr> <int>
## 1 Greenfield 2316
## 2 Parkhead West and Barrowfield 2232
## 3 Cathcart 2126
## 4 Dennistoun North 1822
## 5 Crookston South 1520
## 6 Craigend and Ruchazie 1473
## 7 Langside 1344
## 8 Kingspark South 1266
## 9 Sighthill 1255
## 10 Tollcross 1182
## 11 Drumoyne and Shieldhall 1082
## 12 Alexandra Parade 1054
## 13 Gorbals and Hutchesontown 1021
## 14 Anderston 1020
## 15 Govanhill West 990
## 16 Castlemilk 939
## 17 Darnley North 934
## 18 Whiteinch 916
## 19 Merrylee and Millbrae 878
## 20 Shawlands West 853
## 21 Pollokshaws 846
## 22 Toryglen and Oatlands 732
## 23 Pollokshields East 706
## 24 Garrowhill West 705
## 25 Newlands 648
## 26 Glenwood South 619
## 27 Nitshill 601
## 28 Laurieston and Tradeston 600
## 29 Dennistoun 597
## 30 Partick 594
## 31 Roystonhill, Blochairn, and Provanmill 592
## 32 Braidfauld 569
## 33 Govanhill East and Aikenhead 552
## 34 Baillieston East 546
## 35 City Centre East 533
## 36 Mount Vernon North and Sandyhills 522
## 37 Pollokshields West 519
## 38 Crookston North 515
## 39 Kinning Park and Festival Park 504
## 40 Mount Florida 498
## 41 Ibrox East and Cessnock 495
## 42 Ibrox 486
## 43 Summerston North 461
## 44 Strathbungo 454
## 45 Carnwadric West 450
## 46 Kingspark North 445
## 47 City Centre South 405
## 48 Carmyle and Mount Vernon South 381
## 49 Barlanark 372
## 50 North Kelvin 372
## 51 Craigton 352
## 52 Penilee 348
## 53 Kingston West and Dumbreck 341
## 54 Anniesland East 333
## 55 Glenwood North 311
## 56 Govan and Linthouse 309
## 57 Carmunnock South 308
## 58 Maryhill West 306
## 59 Carntyne 304
## 60 Victoria Park 297
## 61 Dalmarnock 276
## 62 Bridgeton 275
## 63 Parkhead East and Braidfauld North 272
## 64 Maxwell Park 269
## 65 Baillieston West 267
## 66 Mosspark 258
## 67 Cardonald South and East 244
## 68 Cranhill, Lightburn and Queenslie South 242
## 69 Central Easterhouse 241
## 70 Garrowhill East and Swinton 237
## 71 Darnley East 231
## 72 Hillhead 231
## 73 Kelvingrove and University 228
## 74 Pollok North and East 227
## 75 Broomhill 209
## 76 Maryhill East 207
## 77 Springburn East and Cowlairs 206
## 78 Springburn 190
## 79 Summerston Central and West 186
## 80 Hillington 179
## 81 Dowanhill 171
## 82 Ruchill 168
## 83 Woodside 159
## 84 Glasgow Harbour and Partick South 152
## 85 City Centre West 131
## 86 North Barlanark and Easterhouse South 122
## 87 Milton West 119
## 88 Scotstoun North and East 109
## 89 Petershill 102
## 90 Blackhill and Barmulloch East 98
## 91 Barmulloch 93
## 92 Cardonald West and Central 88
## 93 Balornock 84
## 94 Woodlands 83
## 95 Yoker North 79
## 96 Possil Park 58
## 97 Drumry West 54
## 98 Cowlairs and Port Dundas 46
## 99 Knightswood West 44
## 100 Yoker South 43
## 101 Blairdardie East 38
## 102 Drumchapel North 29
## 103 Blairdardie West 25
## 104 Drumry East 16
## 105 Knightswood Park East 15
## 106 Anniesland West 7
## 107 Knightswood East 6
## 108 Battlefield NA
## 109 Calton and Gallowgate NA
## 110 Cardonald North NA
## 111 Carmunnock North NA
## 112 Carntyne West and Haghill NA
## 113 Carnwadric East NA
## 114 Darnley West NA
## 115 Drumchapel South NA
## 116 Easterhouse East NA
## 117 Finnieston and Kelvinhaugh NA
## 118 Firhill NA
## 119 Gallowgate North and Bellgrove NA
## 120 Garthamlock, Auchinlea and Gartloch NA
## 121 Kelvindale NA
## 122 Kelvinside and Jordanhill NA
## 123 Keppochhill NA
## 124 Knightswood Park West NA
## 125 Milton East NA
## 126 Muirend and Old Cathcart NA
## 127 Old Shettleston and Parkhead North NA
## 128 Partickhill and Hyndland NA
## 129 Pollok South and West NA
## 130 Riddrie and Hogganfield NA
## 131 Robroyston and Millerston NA
## 132 Scotstoun South and West NA
## 133 Shawlands East NA
## 134 Shettleston North NA
## 135 Shettleston South NA
## 136 Wyndford NA
Plot
schools_area %>%
ggplot() +
geom_sf(aes(fill = no_of_schools),
show.legend = NA) +
theme_bw() +
scale_fill_continuous(low="thistle2", high="darkred",
guide="colorbar",na.value="white") +
theme(legend.position = "bottom") -> schools_plotly
ggplotly(schools_plotly)